const userService = require('../service/userService');

// 注册
async function register(req, res) {
    let { username, password, img, phone } = req.body;
    let result = await userService.register({ username, password, img, phone });
    res.send(result);
}
// 登录
async function login(req, res) {
    let { phone, password } = req.query;
    let result = await userService.login({ phone, password });
    res.send(result);
}
//管理员登录
async function adminlogin(req, res) {
    let result = await userService.adminlogin(req.query);
    res.send(result);
}

// 查询全部
async function select(req, res) {
    let result = await userService.select();
    res.send(result);
}
// 通过姓名查询
async function selectbyname(req, res) {
    let result = await userService.selectbyname(req.query);
    console.log(result)
    res.send(result);
}
module.exports = { register, login, select, selectbyname, adminlogin };
